#
# Copyright (C) 2004-2009 National Institute of Advanced Industrial
# Science and Technology (AIST), Japan.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
ifeq ($(obj),)
obj		:= .
endif

obj-m		+= sch_psp.o
psp-objs	:= sch_psp.o
export-objs	:= 

ifeq ($(KERNELRELEASE),)
KERNELRELEASE	:= $(shell uname -r)
endif

ifeq ($(KERNELPATH),)
KERNELPATH	:= /lib/modules/$(KERNELRELEASE)/build
endif

MODULEPATH	:= $(DESTDIR)/lib/modules/$(KERNELRELEASE)/kernel/net/sched

INCS		+= -I$(obj)

EXTRA_CFLAGS	+= $(INCS) $(COPTS)

-include $(TOPDIR)/Rules.make

all:
	$(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules

sch_psp.o:
	$(LD) -o sch_psp.ko -r $(psp-objs)

install:
	#strip -S sch_psp.ko
	test -d $(MODULEPATH) || mkdir -p $(MODULEPATH)
	install -m 0644 sch_psp.ko $(MODULEPATH)
ifeq ($(DESTDIR),)
	/sbin/depmod -ae
endif

clean:
	$(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) clean
	-rm -f *~ *.symvers
